package com.hyy.blogtest.common.utils;

import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.io.Encoders;
import io.jsonwebtoken.security.Keys;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.crypto.SecretKey;
import java.security.Key;

@SpringBootTest
public class JwtUtil {

    //签名信息
    public static String secret = "oeWWf6KofPvMtRj+RGiOBB59L6A4yG/TwOrVRkGUZZw=";
    public static Key key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secret));


    @Test
    public void getSecret(){
//        SecretKey secretKey=Keys.hmacShaKeyFor(SignatureAlgorithm.HS256);
        SecretKey secretKey = Keys.secretKeyFor(SignatureAlgorithm.HS256);

        String enCode= Encoders.BASE64.encode(secretKey.getEncoded());

    }

}
